<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ arr.length }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          href="javascript:;"
          :class="{ selected: type === 'all' }"
          @click="fn('all')"
          >全部</a
        >
      </li>
      <li>
        <a
          href="javascript:;"
          :class="{ selected: type === 'no' }"
          @click="fn('no')"
          >未完成</a
        >
      </li>
      <li>
        <a
          href="javascript:;"
          :class="{ selected: type === 'yes' }"
          @click="fn('yes')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="del">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: ["arr"],
  methods: {
    del() {
      this.$emit("delete");
    },
    fn(type) {
      this.type = type;
      this.$emit("checked", type);
    },
  },
  data() {
    return {
      type: "all",
    };
  },
};
</script>